# In python this is slightly slower than a similar implementation in C

from math import sqrt

abundants=set()


def is_abundant(n):
	divisors= set([1])
	for i in range (2, int(sqrt(n))+1):
		if (n % i == 0 and i not in divisors):
			divisors.add(i)
			divisors.add(int(n/i))
	sum=0
	for d in divisors:
		sum+=d
	return True if sum > n else False

def can_be_2abund(n):
	for i in abundants:
		if (n-i) in abundants:
			return True
	return False


for i in range (1, 28123):
	if is_abundant(i):
		abundants.add(i)

#print(len(abundants), " abundant numbers below 28123")

sum=0
for i in range (1, 28124):
	if not can_be_2abund(i):
		sum+=i
print(sum)
